﻿using System;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using DocumentCommon;
using DocumentManagement.Forms;
using DocumentModel;


namespace DocumentManagement
{
    public partial class MDI : Form
    {
        #region Global properties

        public User CurrentUser { get; set; }

        public string UserStatus
        {
            get { return string.Empty; }
            set { }
        }

        public MenuStrip TopMenu
        {
            get { return menuContainer; }
        }

        public ToolStripStatusLabel Status
        {
            get { return statusLabel; }
        }
        #endregion

        public MDI()
        {
            InitializeComponent();
        }

        private void Exit(object sender, EventArgs e)
        {
            Close();
        }           

        #region Menu Quan tri he thong
                
        #endregion        

        private void ShowLogin()
        {
            if (Utilities.OpenForm(this, typeof(Login).Name))
            {
                var form = new Login { MdiParent = this, Dock = DockStyle.Fill };
                mainPanel.Visible = false;

                form.Show();
            }
        }

        private void FormLoad(object sender, EventArgs e)
        {
            if (CurrentUser == null)
            {
                ShowMenu(false);
                ShowLogin();
            }
        }

        private void Logout(object sender, EventArgs e)
        {
            CurrentUser = null;
            UserStatus = string.Empty;

            ShowMenu(false);
            ShowLogin();
        }

        public void ShowMenu(bool flag)
        {
            
        }

        private void OpenGuideline(object sender, EventArgs e)
        {
            var filePath = Path.Combine(Application.StartupPath, "Huong dan su dung_Bauxit.pdf");
            Process.Start(filePath);
        }        
    }
}
